package com.multiplepb.utils;



import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.sql.*;

/**
 */
public class SQLiteUtils {
    private static Connection conn;
    public static Connection getConnect() throws Exception {
        try {
            conn = DriverManager.getConnection("jdbc:sqlite::resource:sqlite/pbzmt.db");
            return conn;
        } catch (SQLException e) {
            e.printStackTrace();
            throw new Exception(e);
        }
    }

    public static Connection getConn() {
        return conn;
    }

    public static void main(String[] args) {
        try {
            String sql = "SELECT id, common_type, common_value FROM common_info WHERE common_type = 1";
            Statement statement = SQLiteUtils.getConnect().createStatement();
            ResultSet resultSet = statement.executeQuery(sql);
            System.out.println(resultSet.getInt("id"));
            System.out.println(resultSet.getInt("common_type"));
            System.out.println(resultSet.getString("common_value"));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
